CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

PROJECT(mumps C Fortran)

FIND_PACKAGE(MPI REQUIRED)

SET(C_FLAGS ${CMAKE_C_FLAGS})


FILE(GLOB C_FILES ${CMAKE_SOURCE_DIR}/src/*.c)
FILE(GLOB FORTRAN_FILES ${CMAKE_SOURCE_DIR}/src/*.F)

INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src ${MPI_Fortran_INCLUDE_PATH})

SET(CMAKE_C_FLAGS "${C_FLAGS} -D MUMPS_ARITH=MUMPS_ARITH_s")
ADD_LIBRARY(smumps ${C_FILES} ${FORTRAN_FILES})

SET(CMAKE_C_FLAGS "${C_FLAGS} -D MUMPS_ARITH=MUMPS_ARITH_d")
ADD_LIBRARY(dmumps ${C_FILES} ${FORTRAN_FILES})

SET(CMAKE_C_FLAGS "${C_FLAGS} -D MUMPS_ARITH=MUMPS_ARITH_c")
ADD_LIBRARY(cmumps ${C_FILES} ${FORTRAN_FILES})

SET(CMAKE_C_FLAGS "${C_FLAGS} -D MUMPS_ARITH=MUMPS_ARITH_z")
ADD_LIBRARY(zmumps ${C_FILES} ${FORTRAN_FILES})

